package com.mgface.framework.websocket;

import java.util.concurrent.TimeUnit;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GreetingController {
	
	@MessageMapping("/sbdwebsocket")
	@SendTo("/topic/greetings")
	public Greeting greeting(HelloMessage message) throws Exception {
		TimeUnit.SECONDS.sleep(1);//模拟操作暂停1S
		return new Greeting("Hello, " + message.getName() + "!");
	}
}
